// To parse this JSON data, do
//
//     final lineDetailModel = lineDetailModelFromJson(jsonString);
/// ! 号警告 执行 dart fix --apply 即可
import 'dart:convert';

LineDetailModel? lineDetailModelFromJson(String str) => LineDetailModel.fromJson(json.decode(str));

String lineDetailModelToJson(LineDetailModel? data) => json.encode(data!.toJson());

class LineDetailModel {
  LineDetailModel({
    this.id,
    this.caption,
    this.swiper,
    this.tag,
    this.otherData,
    this.playSeason,
    this.playSeasonText,
    this.score,
    this.description,
    this.totalDay,
    this.needBuy,
    this.salePrice,
    this.totalDistance,
    this.totalFee,
    this.otherFee,
    this.totalTime,
    this.portraitCompact,
    this.portraitConsume,
    this.portraitDifficulty,
    this.lineData,
    this.userData,
    this.shareInfo,
  });

  int? id;
  String? caption;
  List<Swiper?>? swiper;
  List<String>? tag;
  OtherData? otherData;
  List<PlaySeason?>? playSeason;
  String? playSeasonText;
  String? score;
  String? description;
  var totalDay;
  bool? needBuy;
  String? salePrice;
  int? totalDistance;
  int? totalFee;
  int? otherFee;
  int? totalTime;
  String? portraitCompact;
  String? portraitConsume;
  String? portraitDifficulty;
  List<LineDatum?>? lineData;
  UserData? userData;
  ShareInfo? shareInfo;

  factory LineDetailModel.fromJson(Map<String, dynamic> json) => LineDetailModel(
    id: json["id"],
    caption: json["caption"],
    swiper: json["swiper"] == null ? [] : List<Swiper?>.from(json["swiper"]!.map((x) => Swiper.fromJson(x))),
    tag: json["tag"] == null ? [] : List<String>.from(json["tag"]!.map((x) => x)),
    otherData: OtherData.fromJson(json["otherData"]),
    playSeason: json["playSeason"] == null ? [] : List<PlaySeason?>.from(json["playSeason"]!.map((x) => PlaySeason.fromJson(x))),
    playSeasonText: json["playSeasonText"],
    score: json["score"],
    description: json["description"],
    totalDay: json["totalDay"],
    needBuy: json["needBuy"],
    salePrice: json["salePrice"],
    totalDistance: json["totalDistance"],
    totalFee: json["totalFee"],
    otherFee: json["otherFee"],
    totalTime: json["totalTime"],
    portraitCompact: json["portraitCompact"],
    portraitConsume: json["portraitConsume"],
    portraitDifficulty: json["portraitDifficulty"],
    lineData: json["lineData"] == null ? [] : List<LineDatum?>.from(json["lineData"]!.map((x) => LineDatum.fromJson(x))),
    userData: UserData.fromJson(json["userData"]),
    shareInfo: (json["shareInfo"] ==null) ?null: ShareInfo.fromJson(json["shareInfo"]),
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "caption": caption,
    "swiper": swiper == null ? [] : List<dynamic>.from(swiper!.map((x) => x!.toJson())),
    "tag": tag == null ? [] : List<dynamic>.from(tag!.map((x) => x)),
    "otherData": otherData!.toJson(),
    "playSeason": playSeason == null ? [] : List<dynamic>.from(playSeason!.map((x) => x!.toJson())),
    "playSeasonText": playSeasonText,
    "score": score,
    "description": description,
    "totalDay": totalDay,
    "needBuy": needBuy,
    "salePrice": salePrice,
    "totalDistance": totalDistance,
    "totalFee": totalFee,
    "otherFee": otherFee,
    "totalTime": totalTime,
    "portraitCompact": portraitCompact,
    "portraitConsume": portraitConsume,
    "portraitDifficulty": portraitDifficulty,
    "lineData": lineData == null ? [] : List<dynamic>.from(lineData!.map((x) => x!.toJson())),
    "userData": userData!.toJson(),
    "shareInfo": shareInfo!.toJson(),
  };
}

class LineDatum {
  LineDatum({
    this.dayId,
    this.node,
    this.budget,
    this.totalDistance,
    this.totalFee,
    this.totalTime,
    this.startProvinceId,
    this.startProvinceName,
    this.startCityId,
    this.startCityName,
    this.endCityId,
    this.endCityName,
    this.endProvinceId,
    this.endProvinceName,
  });

  int? dayId;
  List<LineDatumNode?>? node;
  List<Budget?>? budget;
  int? totalDistance;
  int? totalFee;
  int? totalTime;
  int? startProvinceId;
  ProvinceName? startProvinceName;
  int? startCityId;
  String? startCityName;
  int? endCityId;
  String? endCityName;
  int? endProvinceId;
  ProvinceName? endProvinceName;

  factory LineDatum.fromJson(Map<String, dynamic> json) => LineDatum(
    dayId: json["dayId"],
    node: json["node"] == null ? [] : List<LineDatumNode?>.from(json["node"]!.map((x) => LineDatumNode.fromJson(x))),
    budget: json["budget"] == null ? [] : List<Budget?>.from(json["budget"]!.map((x) => Budget.fromJson(x))),
    totalDistance: json["totalDistance"],
    totalFee: json["totalFee"],
    totalTime: json["totalTime"],
    startProvinceId: json["startProvinceId"],
    startProvinceName: provinceNameValues.map[json["startProvinceName"]],
    startCityId: json["startCityId"],
    startCityName: json["startCityName"],
    endCityId: json["endCityId"],
    endCityName: json["endCityName"],
    endProvinceId: json["endProvinceId"],
    endProvinceName: provinceNameValues.map[json["endProvinceName"]],
  );

  Map<String, dynamic> toJson() => {
    "dayId": dayId,
    "node": node == null ? [] : List<dynamic>.from(node!.map((x) => x!.toJson())),
    "budget": budget == null ? [] : List<dynamic>.from(budget!.map((x) => x!.toJson())),
    "totalDistance": totalDistance,
    "totalFee": totalFee,
    "totalTime": totalTime,
    "startProvinceId": startProvinceId,
    "startProvinceName": provinceNameValues.reverse![startProvinceName],
    "startCityId": startCityId,
    "startCityName": startCityName,
    "endCityId": endCityId,
    "endCityName": cityNameValues.reverse![endCityName],
    "endProvinceId": endProvinceId,
    "endProvinceName": provinceNameValues.reverse![endProvinceName],
  };
}

class Budget {
  Budget({
    this.type,
    this.typeName,
    this.node,
  });

  int? type;
  String? typeName;
  List<BudgetNode?>? node;

  factory Budget.fromJson(Map<String, dynamic> json) => Budget(
    type: json["type"],
    typeName: json["typeName"],
    node: json["node"] == null ? [] : List<BudgetNode?>.from(json["node"]!.map((x) => BudgetNode.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "type": type,
    "typeName": typeName,
    "node": node == null ? [] : List<dynamic>.from(node!.map((x) => x!.toJson())),
  };
}

class BudgetNode {
  BudgetNode({
    this.nodeId,
    this.caption,
    this.fee,
    this.logo,
    this.address,
  });

  int? nodeId;
  String? caption;
  int? fee;
  String? logo;
  String? address;

  factory BudgetNode.fromJson(Map<String, dynamic> json) => BudgetNode(
    nodeId: json["nodeId"],
    caption: json["caption"],
    fee: json["fee"],
    logo: json["logo"],
    address: json["address"],
  );

  Map<String, dynamic> toJson() => {
    "nodeId": nodeId,
    "caption": caption,
    "fee": fee,
    "logo": logo,
    "address": address,
  };
}

enum CityName { EMPTY, CITY_NAME, PURPLE }

final cityNameValues = EnumValues({
  "焦作": CityName.CITY_NAME,
  "郑州": CityName.EMPTY,
  "新乡": CityName.PURPLE
});

enum ProvinceName { EMPTY }

final provinceNameValues = EnumValues({
  "河南": ProvinceName.EMPTY
});

class LineDatumNode {
  LineDatumNode({
    this.nodeId,
    this.type,
    this.arriveTime,
    this.arriveTimeSecond,
    this.caption,
    this.lng,
    this.lat,
    this.distance,
    this.distanceText,
    this.duration,
    this.durationText,
    this.provinceId,
    this.provinceName,
    this.cityId,
    this.cityName,
    this.phone,
    this.fee,
    this.images,
    this.address,
    this.poiDetail,
    this.userDesc,
  });

  int? nodeId;
  int? type;
  String? arriveTime;
  int? arriveTimeSecond;
  String? caption;
  double? lng;
  double? lat;
  int? distance;
  String? distanceText;
  int? duration;
  String? durationText;
  int? provinceId;
  ProvinceName? provinceName;
  int? cityId;
  CityName? cityName;
  String? phone;
  int? fee;
  List<String?>? images;
  String? address;
  PoiDetail? poiDetail;
  UserDesc? userDesc;

  factory LineDatumNode.fromJson(Map<String, dynamic> json) => LineDatumNode(
    nodeId: json["nodeId"],
    type: json["type"],
    arriveTime: json["arriveTime"],
    arriveTimeSecond: json["arriveTimeSecond"],
    caption: json["caption"],
    lng: json["lng"].toDouble(),
    lat: json["lat"].toDouble(),
    distance: json["distance"],
    distanceText: json["distanceText"],
    duration: json["duration"],
    durationText: json["durationText"],
    provinceId: json["provinceId"],
    provinceName: provinceNameValues.map[json["provinceName"]],
    cityId: json["cityId"],
    cityName: cityNameValues.map[json["cityName"]],
    phone: json["phone"],
    fee: json["fee"],
    images: json["images"] == null ? [] : List<String?>.from(json["images"]!.map((x) => x)),
    address: json["address"],
    poiDetail: PoiDetail.fromJson(json["poiDetail"]),
    userDesc: json["userDesc"] == null?null:UserDesc.fromJson(json["userDesc"]),
  );

  Map<String, dynamic> toJson() => {
    "nodeId": nodeId,
    "type": type,
    "arriveTime": arriveTime,
    "arriveTimeSecond": arriveTimeSecond,
    "caption": caption,
    "lng": lng,
    "lat": lat,
    "distance": distance,
    "distanceText": distanceText,
    "duration": duration,
    "durationText": durationText,
    "provinceId": provinceId,
    "provinceName": provinceNameValues.reverse![provinceName],
    "cityId": cityId,
    "cityName": cityNameValues.reverse![cityName],
    "phone": phone,
    "fee": fee,
    "images": images == null ? [] : List<dynamic>.from(images!.map((x) => x)),
    "address": address,
    "poiDetail": poiDetail!.toJson(),
    "userDesc": userDesc!.toJson(),
  };
}

class PoiDetail {
  PoiDetail({
    this.id,
    this.type,
    this.caption,
    this.images,
    this.address,
    this.logo,
    this.phone,
    this.price,
    this.desc,
    this.advice,
    this.playInterval,
  });

  int? id;
  int? type;
  String? caption;
  List<String?>? images;
  String? address;
  String? logo;
  String? phone;
  dynamic price;
  String? desc;
  String? advice;
  int? playInterval;

  factory PoiDetail.fromJson(Map<String, dynamic> json) => PoiDetail(
    id: json["id"],
    type: json["type"],
    caption: json["caption"],
    images: json["images"] == null ? [] : List<String?>.from(json["images"]!.map((x) => x)),
    address: json["address"],
    logo: json["logo"],
    phone: json["phone"],
    price: json["price"],
    desc: json["desc"],
    advice: json["advice"],
    playInterval: json["playInterval"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "type": type,
    "caption": caption,
    "images": images == null ? [] : List<dynamic>.from(images!.map((x) => x)),
    "address": address,
    "logo": logo,
    "phone": phone,
    "price": price,
    "desc": desc,
    "advice": advice,
    "playInterval": playInterval,
  };
}

class UserDesc {
  UserDesc({
    this.say,
    this.images,
    this.avatar,
    this.advice,
  });

  String? say;
  List<String?>? images;
  String? avatar;
  String? advice;

  factory UserDesc.fromJson(Map<String, dynamic> json) => UserDesc(
    say: json["say"],
    images: json["images"] == null ? [] : List<String?>.from(json["images"]!.map((x) => x)),
    avatar: json["avatar"],
    advice: json["advice"],
  );

  Map<String, dynamic> toJson() => {
    "say": say,
    "images": images == null ? [] : List<dynamic>.from(images!.map((x) => x)),
    "avatar": avatar,
    "advice": advice,
  };
}

class OtherData {
  OtherData({
    this.isFav,
    this.canGo,
    this.goUrl,
    this.giftBagId,
    this.giftUrl,
  });

  bool? isFav;
  bool? canGo;
  String? goUrl;
  int? giftBagId;
  String? giftUrl;

  factory OtherData.fromJson(Map<String, dynamic> json) => OtherData(
    isFav: json["isFav"],
    canGo: json["canGo"],
    goUrl: json["goUrl"],
    giftBagId: json["giftBagId"],
    giftUrl: json["giftUrl"],
  );

  Map<String, dynamic> toJson() => {
    "isFav": isFav,
    "canGo": canGo,
    "goUrl": goUrl,
    "giftBagId": giftBagId,
    "giftUrl": giftUrl,
  };
}

class PlaySeason {
  PlaySeason({
    this.start,
    this.end,
  });

  int? start;
  int? end;

  factory PlaySeason.fromJson(Map<String, dynamic> json) => PlaySeason(
    start: json["start"],
    end: json["end"],
  );

  Map<String, dynamic> toJson() => {
    "start": start,
    "end": end,
  };
}

class ShareInfo {
  ShareInfo({
    this.canShare,
    this.shareType,
    this.commonData,
    this.shareData,
  });

  bool? canShare;
  String? shareType;
  CommonData? commonData;
  ShareData? shareData;

  factory ShareInfo.fromJson(Map<String, dynamic> json) => ShareInfo(
    canShare: json["canShare"],
    shareType: json["shareType"],
    commonData: CommonData.fromJson(json["commonData"]),
    shareData: ShareData.fromJson(json["shareData"]),
  );

  Map<String, dynamic> toJson() => {
    "canShare": canShare,
    "shareType": shareType,
    "commonData": commonData!.toJson(),
    "shareData": shareData!.toJson(),
  };
}

class CommonData {
  CommonData({
    this.title,
    this.description,
    this.logo,
  });

  String? title;
  String? description;
  String? logo;

  factory CommonData.fromJson(Map<String, dynamic> json) => CommonData(
    title: json["title"],
    description: json["description"],
    logo: json["logo"],
  );

  Map<String, dynamic> toJson() => {
    "title": title,
    "description": description,
    "logo": logo,
  };
}

class ShareData {
  ShareData({
    this.text,
    this.image,
    this.webPage,
    this.wxMini,
  });

  TextModel? text;
  ImageModel? image;
  WebPage? webPage;
  WxMini? wxMini;

  factory ShareData.fromJson(Map<String, dynamic> json) => ShareData(
    text: TextModel.fromJson(json["text"]),
    image: ImageModel.fromJson(json["image"]),
    webPage: WebPage.fromJson(json["webPage"]),
    wxMini: WxMini.fromJson(json["wxMini"]),
  );

  Map<String, dynamic> toJson() => {
    "text": text!.toJson(),
    "image": image!.toJson(),
    "webPage": webPage!.toJson(),
    "wxMini": wxMini!.toJson(),
  };
}

class ImageModel {
  ImageModel({
    this.url,
    this.thumb,
  });

  String? url;
  String? thumb;

  factory ImageModel.fromJson(Map<String, dynamic> json) => ImageModel(
    url: json["url"],
    thumb: json["thumb"],
  );

  Map<String, dynamic> toJson() => {
    "url": url,
    "thumb": thumb,
  };
}

class TextModel {
  TextModel({
    this.text,
  });

  String? text;

  factory TextModel.fromJson(Map<String, dynamic> json) => TextModel(
    text: json["text"],
  );

  Map<String, dynamic> toJson() => {
    "text": text,
  };
}

class WebPage {
  WebPage({
    this.url,
  });

  String? url;

  factory WebPage.fromJson(Map<String, dynamic> json) => WebPage(
    url: json["url"],
  );

  Map<String, dynamic> toJson() => {
    "url": url,
  };
}

class WxMini {
  WxMini({
    this.webPageUrl,
    this.userName,
    this.path,
  });

  String? webPageUrl;
  String? userName;
  String? path;

  factory WxMini.fromJson(Map<String, dynamic> json) => WxMini(
    webPageUrl: json["webPageUrl"],
    userName: json["userName"],
    path: json["path"],
  );

  Map<String, dynamic> toJson() => {
    "webPageUrl": webPageUrl,
    "userName": userName,
    "path": path,
  };
}

class Swiper {
  Swiper({
    this.id,
    this.name,
    this.type,
    this.url,
  });

  dynamic id;
  String? name;
  String? type;
  String? url;

  factory Swiper.fromJson(Map<String, dynamic> json) => Swiper(
    id: json["id"],
    name: json["name"],
    type: json["type"],
    url: json["url"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "name": name,
    "type": type,
    "url": url,
  };
}

class UserData {
  UserData({
    this.id,
    this.avatar,
    this.nickname,
    this.isMine,
    this.follow,
  });

  int? id;
  String? avatar;
  String? nickname;
  bool? isMine;
  bool? follow;

  factory UserData.fromJson(Map<String, dynamic> json) => UserData(
    id: json["id"],
    avatar: json["avatar"],
    nickname: json["nickname"],
    isMine: json["isMine"],
    follow: json["follow"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "avatar": avatar,
    "nickname": nickname,
    "isMine": isMine,
    "follow": follow,
  };
}

class EnumValues<T> {
  Map<String, T> map;
  Map<T, String>? reverseMap;

  EnumValues(this.map);

  Map<T, String>? get reverse {
    reverseMap ??= map.map((k, v) => MapEntry(v, k));
    return reverseMap;
  }
}
